using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
using MiniStock.Entities.Common.Events;

namespace MiniStock.Entities.Common
{
    [Serializable]
    [KnownType("GetKnownTypes")]
    [DataContract(IsReference=true)]
    public class EntityBase
    {
        [DataMember]
        public Guid Id { get; set; }

        public virtual string GetEntityHash()
        {
            return GetType().Name + "|" + Id;
        }

        public static IEnumerable<Type> GetKnownTypes()
        {
            return SerializationHelper.KnownEntityTypes;
        }


        public virtual void CopyFrom(EntityBase source, int depthLimit = -1)
        {
            this.Id = source.Id;
        }
    }
}